package io;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class TestNote {
    public static void main(String[] args) throws IOException {
       // FileInputStream fis = new FileInputStream("note.txt");
        File file = new File("fos.txt");
        FileOutputStream fos = new FileOutputStream(file);
        Scanner scan = new Scanner(System.in);

        while (true){
            System.out.println("请输入文件内容：");
            String  str =scan.next();

            if(str.equals("exit")){
                System.out.println("程序退出！");
                break;
            }
            fos.write(str.getBytes(StandardCharsets.UTF_8));

        }
        fos.close();

    }
}
